package com.lg.baselibrary.widget;

import android.content.Context;
import android.support.annotation.Nullable;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;

/**
 * Created by LiGang on 2017/5/29.
 */

public class BottomTabViewForViewPager extends BottomTabView{

    public BottomTabViewForViewPager(Context context) {
        super(context);
    }

    public BottomTabViewForViewPager(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }
    /**
     * 连接 Viewpager
     * @param viewPager　
     */
    public void setUpWithViewPager(final ViewPager viewPager){
        viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
            @Override
            public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

            }

            @Override
            public void onPageSelected(int position) {
                switchTab(position);
            }

            @Override
            public void onPageScrollStateChanged(int state) {

            }
        });
    }
}
